package com.demoo.zjsu.util.javamail;

/**
 * Created by jshjsh on 2016/8/14.
 */
public class MailSenderThread implements Runnable{

    public MailSenderThread(String subject, String text) {
        target = new Target(subject, text);
    }

    private Target target;

    public Target getTarget() {
        return target;
    }

    public void setTarget(Target target) {
        this.target = target;
    }

    public void run() {
        synchronized (this){
            SimpleMailSender sender = SimpleMailSender.getSenderInstance(target);
            sender.sendSimpleMail();
            try {
                Thread.sleep(1000*60*60);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }


}
